.\" -*- nroff -*-
.\" Copyright 2010 Cisco Systems, Inc.  All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines
.\" Copyright (c) 2020      Google, LLC. All rights reserved.
.\" $COPYRIGHT$
.TH MPI_Type_create_f90_complex 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"

.SH NAME
.nf
\fBMPI_Type_create_f90_complex\fP \- Returns a bounded MPI complex datatype

.fi
.SH SYNTAX
.ft R

.SH C Syntax
.nf
#include <mpi.h>
int MPI_Type_create_f90_complex(int \fIp\fP, int \fIr\fP,
	MPI_Datatype *\fInewtype\fP)

.fi
.SH Fortran Syntax
.nf
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_TYPE_CREATE_F90_COMPLEX (\fIP, R, NEWTYPE, IERROR\fP)
	INTEGER	\fIP, R, NEWTYPE, IERROR\fP

.fi
.SH Fortran 2008 Syntax
.nf
USE mpi_f08
MPI_Type_create_f90_complex(\fIp\fP, \fIr\fP, \fInewtype\fP, \fIierror\fP)
	INTEGER, INTENT(IN) :: \fIp\fP, \fIr\fP
	TYPE(MPI_Datatype), INTENT(OUT) :: \fInewtype\fP
	INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP

.fi
.SH INPUT PARAMETERS
.ft R
.TP 1i
p
Precision, in decimal digits (integer).
.TP 1i
r
Decimal exponent range (integer).

.SH OUTPUT PARAMETERS
.ft R
.TP 1i
newtype
New data type (handle).
.TP 1i
IERROR
Fortran only: Error status (integer).

.SH DESCRIPTION
.ft R
This function provides a way to declare KIND-parameterized COMPLEX MPI
datatypes. The arguments are interpreted in a similar fashion to the
F90 function SELECTED_REAL_KIND. The parameters \fIp\fP and \fIr\fP
must be scalar integers. The argument \fIp\fP represents the required
level of numerical precision, in decimal digits. The \fIr\fP parameter
indicates the range of exponents desired: the returned datatype will
have at least one exponent between \+\fIr\fP and \-\fIr\fP (inclusive).
.sp
Either \fIp\fP or \fIr\fP, but not both, may be omitted from calls to
SELECTED_REAL_KIND. Similarly, either argument to
MPI_Type_create_f90_complex may be set to MPI_UNDEFINED.

.SH NOTES
.ft R
It is erroneous to supply values for \fIp\fP and \fIr\fP not supported by
the compiler.
.sp
The Fortran function SELECTED_REAL_KIND maps a large number of
(\fIp,r\fP) pairs to a much smaller number of KIND parameters
supported by the compiler. KIND parameters are not specified by the
language and are not portable. From the point of view of the language,
variables of the same base type and KIND parameter are equivalent,
even if their KIND parameters were generated by different (\fIp,r\fP)
arguments to SELECTED_REAL_KIND. However, to help facilitate
interoperability in a heterogeneous environment, equivalency is more
strictly defined for datatypes returned by
MPI_Type_create_f90_complex. Two MPI datatypes, each generated by this
function, will match if and only if they have identical values for
both \fIp\fP and \fIr\fP.
.sp
The interaction between the datatypes returned by this function and
the external32 data representation \- used by MPI_Pack_external,
MPI_Unpack_external, and many MPI_File functions \- is subtle. The
external32 representation of returned datatypes is as follows.
.sp
.nf
	if (\fIp\fP > 33) and/or (\fIr\fP > 4931):
		external32 size = n/a (undefined)
	else if (\fIp\fP > 15) and/or (\fIr\fP > 307):
		external32 size = 32
	else if (\fIp\fP > 6) and/or (\fIr\fP > 37):
		external32 size = 16
	else:
		external32 size = 8
.fi
.sp
If the external32 representation of a datatype is undefined, so are
the results of using that datatype in operations that require the
external32 format. Care should be taken not to use incompatible
datatypes indirectly, e.g., as part of another datatype or through a
duplicated datatype, in these functions.
.sp
If a variable is declared specifying a nondefault KIND value that was
not obtained with SELECTED_REAL_KIND (i.e., \fIp\fP and/or \fIr\fP are
unknown), the only way to obtain a matching MPI datatype is to use the
functions MPI_Sizeof and MPI_Type_match_size.

.SH ERRORS
.ft R
Almost all MPI routines return an error value; C routines as
the value of the function and Fortran routines in the last argument.
.sp
Before the error value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job, except for
I/O function errors. The error handler may be changed with
MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN
may be used to cause error values to be returned. Note that MPI does not
guarantee that an MPI program can continue past an error.
.sp
See the MPI man page for a full list of MPI error codes.

.SH SEE ALSO
.ft R
.nf
MPI_Pack_external
MPI_Sizeof
MPI_Type_match_size
MPI_Unpack_external
SELECTED_REAL_KIND

